<?php

namespace app\adminapi\controller\v1\office;

use app\adminapi\controller\AuthController;
use app\services\office\OfficeRulesService;
use think\facade\App;

class OfficeRules extends AuthController
{
    public function __construct(App $app,OfficeRulesService  $service)
    {
        parent::__construct($app);
        $this ->services = $service;
    }

    public function index()
    {
        $where = $this->request->postMore([
            ['page', 1],
            ['pageSize', 20],
            ['website_id', $this->website],
            ['class_id', ''],
        ]);
        return app()->make('json')->successful($this->services->index($where));
    }

    public function createOrUpdate()
    {
        $where = $this->request->postMore([
            ['id',''],
            ['class_id', ''],
            ['website_id', ''],
            ['video_ratio', ''],
            ['work_ratio', ''],
            ['text_ratio', ''],
            ['work_start_time', ''],
            ['work_end_time', ''],
            ['exam_end_time', ''],
            ['exam_start_time', ''],
            ['website_id', $this->website]
        ]);
        return app()->make('json')->successful($this->services->createOrUpdate($where));
    }

    public function delete()
    {
        $where = $this->request->postMore([
            ['id', 1],
        ]);
        return app()->make('json')->successful($this->services->delete($where));
    }



}